<?php

require_once './HttpClient/HttpClient.php';
require_once 'Zend/Json/Decoder.php';

/**
 * Description of VirtualLabs_Rest_Util
 *
 * @author markos
 */
class Util {

    /**
     * Check an asynchronous job status by the $jobid
     * 
     * @param string $id Job id to verify
     * @return mixed $jobStatus An array with the information about the job.
     */
    public function jobStatus($id, $log) {
        $url = array();
        $url["response"] = "json";
        $url["command"] = "queryAsyncJobResult";
        $url["jobid"] = $id;
        $v = new HttpClient($log);
        try {
            $response = $v->call($url);
            $jobIdStatusResponse = Zend_Json_Decoder::decode($response);
            return $jobIdStatusResponse;
        } catch (Exception $e) {
            throw $e;
        }
    }

}

?>
